#define  _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<string.h>

int main()
{
    int n = 0, i = 0, j = 0, arr[1100][1100] = { 0 }, a = 0, b = 0, c = 0;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            scanf("%d", &arr[i][j]);
            if (arr[i][j] == 0)
                a = i;
        }
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j < n; j++)
        {
            if (arr[i][j] == 0)
            {
                b = i;
                goto end;
            }
        }
    }
end:
    for (i = b; i < n; i++)
    {
        if (arr[b][i] == 0)
            c = i;
    }
     
    return 0;
}